1 /* 2 * Copyright (c) 2011-2014 - Mauro Carvalho Chehab 3 * Copyright (c) 2012 - Andre Roth <neolynx@gmail.com> 4 * 5 * This program is free software; you can redistribute it and/or modify 6 * it under the terms of the GNU Lesser General Public License as published by 7 * the Free Software Foundation version 2.1 of the License. 8 * 9 * This program is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * GNU Lesser General Public License for more details. 13 * 14 * You should have received a copy of the GNU Lesser General Public License 15 * along with this program; if not, write to the Free Software 16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 17 * Or, point your browser to http://www.gnu.org/licenses/old-licenses/gpl-2.0.html 18 * 19 */ 20 21 module libdvbv5_d.dvb_log; 22 23 import libdvbv5_d.dvb_fe: dvb_v5_fe_parms; 24 25 extern (C): 26 27 /** 28 * @file dvb-log.h 29 * @ingroup ancillary 30 * @brief Provides interfaces to handle libdvbv5 log messages. 31 * @copyright GNU Lesser General Public License version 2.1 (LGPLv2.1) 32 * @author Mauro Carvalho Chehab 33 * @author Andre Roth 34 * 35 * @par Bug Report 36 * Please submit bug reports and patches to linux-media@vger.kernel.org 37 */ 38 39 /** 40 * @typedef void (*dvb_logfunc)(int level, const char *fmt, ...) 41 * @brief typedef used by dvb_fe_open2 for the log function 42 * @ingroup ancillary 43 */ 44 45 alias dvb_logfunc = void function (int level, const(char)* fmt, ...); 46 47 /** 48 * @typedef void (*dvb_logfunc)(void *logpriv, int level, const char *fmt, ...) 49 * @brief typedef used by dvb_fe_open2 for the log function with private context 50 * @ingroup ancillary 51 */ 52 53 alias dvb_logfunc_priv = void function (void* logpriv, int level, const(char)* fmt, ...); 54 55 /* 56 * Macros used internally inside libdvbv5 frontend part, to output logs 57 */ 58 59 // struct dvb_v5_fe_parms; 60 /** 61 * @brief retrieve the logging function with private data from the private fe params. 62 */ 63 dvb_logfunc_priv dvb_get_log_priv (dvb_v5_fe_parms*, void**); 64 65 extern (D) auto dvb_perror(T)(auto ref T msg) 66 { 67 return dvb_logerr("%s: %s", msg, strerror(errno)); 68 } 69 70 /* _DOXYGEN */ 71 72 /** 73 * @brief This is the prototype of the internal log function that it is used, 74 * if the library client doesn't desire to override with something else. 75 * @ingroup ancillary 76 * 77 * @param level level of the message, as defined at syslog.h 78 * @param fmt format string (same as format string on sprintf) 79 */ 80 void dvb_default_log (int level, const(char)* fmt, ...);